import request from '@/utils/request'

// 查询订单统计列表
export function listOrder(query) {
  return request({
    url: '/business/order/list',
    method: 'get',
    params: query
  })
}

// 查询订单统计详细
export function getOrder(id) {
  return request({
    url: '/business/order/' + id,
    method: 'get'
  })
}

// 新增订单统计
export function addOrder(data) {
  return request({
    url: '/business/order',
    method: 'post',
    data: data
  })
}

// 修改订单统计
export function updateOrder(data) {
  return request({
    url: '/business/order',
    method: 'put',
    data: data
  })
}

// 删除订单统计
export function delOrder(id) {
  return request({
    url: '/business/order/' + id,
    method: 'delete'
  })
}

// 查询开电方式列表
export function getChargeTypeList() {
  return request({
    url: '/business/order/chargeType/list',
    method: 'get'
  })
}

// 查看订单功率曲线图
export function getOrderPower(data) {
  return request({
    url: '/snap/charge/order/power2',
    method: 'post',
    data: data
  })
}
// 查看订单SOC曲线图
export function getOrderPowerSoc(data) {
  return request({
    url: '/snap/charge/order/soc',
    method: 'post',
    data: data
  })
}
// 查看订单温度曲线图
export function getOrderPowerTem(data) {
  return request({
    url: '/snap/charge/order/tem',
    method: 'post',
    data: data
  })
}

// 查看订单SOC曲线图
export function closeOrder(orderId) {
  return request({
    url: `/business/order/closeOrder/${orderId}`,
    method: 'get',
  })
}
/**
 * 查询用户以及账户详细信息
 * @param {string} consumerId 用户ID
 * @returns
 */
export function getConsumerAndAccount(consumerId) {
  return request({
    url:`/business/consumer/getConsumerAndAccount/${consumerId}`,
    method: 'get'
  });
}

/**
 * 获取场站设备的详细信息
 * @param {string} orderNo 订单编号
 * @returns
 */
export function getChargeAndDevice(orderNo) {
  return request({
    url: `/business/manager/getChargeAndDevice/${orderNo}`,
    method: 'get'
  });
}

// 查询订单统计列表
export function getListByChargeStationId(query, stationId, beginTime, endTime) {
  return request({
    url: `/business/order/getListByChargeStationId/${stationId}/${beginTime}/${endTime}`,
    method: 'get',
    params: query
  })
}

// 手动结算订单，发出开电指令状态下可以使用
export function manualSettlement(orderId) {
  return request({
    url: `/business/order/manualSettlement/${orderId}`,
    method: 'get'
  })
}

